import React, { Component } from 'react';
import Child from './child-props'
class Parent extends Component {
    state={
        val:1
    };

    handleVal = (p) => {
        this.setState({
            val:p
        })
    };
    render() {
        return (
            <div>
                <span>name:{this.state.val}</span>
                <div className="">--------------同级组件传值/双向数据绑定---------------</div>
                <Child handleVal={this.handleVal} />
            </div>
        );
    }
}

export default Parent;
